﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Adjustment.aspx.cs" Inherits="WMS6.Web.Inventory.Adjustment" meta:resourcekey="Page" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Adjustment</title>
    <link href="../style/zh/1/css.css" type="text/css" rel="Stylesheet" id="mycss" />
    <link href="../Css/style.css" type="text/css" rel="stylesheet" />

    <script src="../Js/jquery.js" type="text/javascript"></script>

    <script src="../Js/jquery.simplemodal.js" type="text/javascript"></script>

    <script src="../Js/util.js" type="text/javascript"></script>

    <script src="../Js/calendar.js" type="text/javascript" charset="gb2312"></script>

    <script src="../Js/InitPage.js" type="text/javascript"></script>

    <script src="../Js/checkbox.js" type="text/javascript"></script>

    <script src="../Js/Verification.js" type="text/javascript"></script>

    <script type="text/javascript">
        //初始化页面
        window.onload = function(){
            initEditNewPage();
        }
        
        function newReceiving()
        {
            var from = document.getElementById("hdnFrom").value;
            window.location.href = "Receiving.aspx?from=" + escape(from);
            return false;
        }
        function Check(lineId,qtyId)
        {    
              var type = true; 
              var checkvalue=document.getElementById("hidCheck").value.split(',');
           
             for(var i =0;checkvalue.length>i;i++ )
             {
                  if(checkvalue[i] == lineId)
                  {
                      type=false;
                      document.getElementById("hidCheck").value= document.getElementById("hidCheck").value.replace(lineId+',' ,"");
                      document.getElementById(qtyId).innerHTML = document.getElementById(qtyId).innerHTML.replace('-','');
                       return;
                  }     
              }         
              
              if(type)
              {
                  if(document.getElementById(qtyId).innerHTML > 0)
                  {
                     document.getElementById("hidCheck").value += lineId+',';
                     document.getElementById(qtyId).innerHTML = '-'+document.getElementById(qtyId).innerHTML;
                  }
              }            
        }
      function pageselectAll(chkbox,gv)
     {
         var state = chkbox.checked;                  
         var TargetBaseControl = document.getElementById(gv);  
         var TargetChildControl = chkbox;          
         var Inputs = TargetBaseControl.getElementsByTagName("input"); 
         for(var i=0;i<Inputs.length;i++)
         {
            if(Inputs[i].type == 'checkbox')
            {
                Inputs[i].checked = state;
                if(state)
                {
                
                }
                else
                {
                
                }
            }
         }
      }	
       //弹出窗口选择货主
        function selectOwner()
        {
            var rtnValue = popModalWindow('../Configuration/OwnerQuery.aspx?action=txtOwnerID','dialogWidth=800px;dialogHeight=500px;center=yes;resizable=yes;status=no;');
            if(rtnValue != null && rtnValue.toString() != "")
            {              
                document.getElementById("txtOwnerID").value = rtnValue;
               // document.getElementById("txtOwnerID").focus();
            }
        }
        
        function confirmMsg(code)
        {
            if(code == "C010")
            {
                if(confirm('<%=GetGlobalMsgResource("C010") %>'))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else if(code == "F5150_001")
            {
                if(confirm('<%=GetGlobalMsgResource("F5150_001") %>'))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

        }
        
    </script>

</head>
<body>
    <form id="F5031" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                <div id="div_top">
                    <table>
                        <tr>
                            <td valign="bottom">
                                <asp:Label ID="lblASN" runat="server" CssClass="label_header" Text="库存调整" 
                                    meta:resourcekey="lblASN"></asp:Label>
                            </td>
                            <td>
                                <asp:Button ID="btnGoBack" runat="server" CssClass="button" Enabled="False" Text="<%$Resources:ButtonResource,btnGoBack%>"
                                    AccessKey="b" OnClick="btnGoBack_Click"  />
                            </td>
                            <td>
                                <asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Enabled="False" CssClass="button"
                                    Text="<%$Resources:ButtonResource,btnNew%>" AccessKey="n" />
                            </td>
                            <td>
                                <asp:Button ID="btnSave" runat="server" CssClass="button" Enabled="False" Text="<%$Resources:ButtonResource,btnSave%>"
                                    OnClick="btnSave_Click" AccessKey="s"  />
                            </td>
                            <td>
                                <asp:Button ID="btnRefresh" runat="server" CssClass="button" Enabled="False" Text="<%$Resources:ButtonResource,btnRefresh%>"
                                    AccessKey="e" />
                            </td>
                        </tr>
                    </table>
                </div>
                <div>
                    <asp:Label ID="lblMsg" runat="server" CssClass="label_message" ></asp:Label>
                </div>
                <div id="div_menu">
                    <div style="float: left; width: 8px;">
                        <div class="tabL" id="divL1">
                        </div>
                    </div>
                    <div style="float: left;" class="tabLabelCont tabCur" onclick="setTab('one',1,2)"
                        id="divM1">
                        <asp:Label ID="one1" CssClass="hover" runat="server" 
                            meta:resourcekey="one1">常规</asp:Label></div>
                    <div style="float: left; margin-right: 2px;">
                        <div class="tabR" id="divR1">
                        </div>
                    </div>
                    <div style="float: left; width: 8px;">
                        <div class="tabL_1" id="divL2">
                        </div>
                    </div>
                    <div style="float: left;" class="tabLabelCont tabCur_1" onclick="setTab('one',2,2)"
                        id="divM2">
                        <asp:Label ID="one2" CssClass="navigationlabel" runat="server" 
                            meta:resourcekey="one2">调整单明细</asp:Label></div>
                    <div style="float: left; margin-right: 2px;">
                        <div class="tabR_1" id="divR2">
                        </div>
                    </div>
                </div>
                <div id="div_content">
                    <div id="con_one_1" style="display: block;">
                        <table width="540px" style="display: block; margin-left: 10px; margin-top: 10px;">
                            <tr>
                                <td width="180">
                                    <asp:Label ID="lblAdJustMentID" runat="server" CssClass="label" Text="调整单号" 
                                        meta:resourcekey="lblAdJustMentID"></asp:Label>
                                </td>
                                <td width="180">
                                    <asp:Label ID="lblCreatedBy" runat="server" CssClass="label" Text="制单人" 
                                        meta:resourcekey="lblCreatedBy"></asp:Label>
                                </td>
                                <td width="180">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:TextBox ID="txtAdJustMentID" runat="server" CssClass="textbox" 
                                        meta:resourcekey="txtAdJustMentID"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtCreatedBy" runat="server" CssClass="textbox" 
                                        Enabled="False" meta:resourcekey="txtCreatedBy"></asp:TextBox>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td width="180">
                                    <asp:Label ID="lblOwnerID" runat="server" CssClass="label" Text="货主代码" 
                                        meta:resourcekey="lblOwnerID"></asp:Label><font
                                        class="must_input">*</font>
                                </td>
                                <td width="180">
                                    <asp:Label ID="lblRemark" runat="server" CssClass="label" Text="备注" 
                                        meta:resourcekey="lblRemark"></asp:Label>
                                </td>
                                <td width="180">
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:TextBox ID="txtOwnerID" runat="server" CssClass="textbox" 
                                        meta:resourcekey="txtOwnerID"></asp:TextBox><img
                                        src="../Images/icon_find.gif" alt="select one item" class="img" onclick="selectOwner();"
                                        id="img" runat="server" />
                                </td>
                                <td colspan="2" rowspan="3">
                                    <asp:TextBox ID="txtRemark" runat="server" MaxLength="100" CssClass="largetextarea" 
                                        TextMode="MultiLine" meta:resourcekey="txtRemark"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="180">
                                    <asp:Label ID="lblAdJustMentDate" runat="server" CssClass="label" Text="调整日期" 
                                        meta:resourcekey="lblAdJustMentDate"></asp:Label><font
                                        class="must_input">*</font>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:TextBox ID="txtAdJustMentDate" runat="server" CssClass="textbox" 
                                        onblur="JavaScript:dataVer._IsTime(this,'lblMsg')" 
                                        meta:resourcekey="txtAdJustMentDate"></asp:TextBox>
                                    <img src="../Images/calendar.gif" class="img" alt="请选择日期" id="imgTime" runat="server"
                                        onclick="setday(this,txtAdJustMentDate)" />
                                </td>
                            </tr>
                            <tr style="height: 10px;">
                                <td width="180">
                                </td>
                                <td width="180">
                                </td>
                                <td width="180">
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="con_one_2" style="display: none; overflow-x: auto; overflow-y: hidden;">
                        <table width="1000px" style="display: block; margin-left: 10px; margin-top: 10px;">
                            <tr>
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                <asp:Button ID="btnAddDetail" runat="server" CssClass="button" Text="<%$Resources:ButtonResource,btnAddDetail%>" OnClientClick="javascript:if(document.getElementById('hdnReceiptID').value == ''){if(confirmMsg('F5150_001')) return true; else return false;}"
                                                    OnClick="btnAddDetail_Click" />
                                            </td>
                                            <td>
                                                <asp:Button ID="btnDeleteDetail" runat="server" CssClass="button" Text="<%$Resources:ButtonResource,btnDeleteDetail%>" Visible="False"
                                                    OnClientClick="javascript:if(confirmMsg('C010')) return true; else return false;"
                                                    OnClick="btnDeleteDetail_Click"  />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr style="height: 10px;">
                                <td>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div>
                                        <asp:GridView ID="gvadjustmentDetail" Width="1200px" runat="server" 
                                            AllowSorting="True"  AllowPaging="True" 
                                            AutoGenerateColumns="False" CssClass="gridview" OnRowDataBound="gvadjustmentDetail_RowDataBound"
                                            DataKeyNames="AdjustmentID,LineID" OnPageIndexChanging="gvadjustmentDetail_PageIndexChanging"
                                            OnSorting="gvadjustmentDetail_Sorting" oninit="gvadjustmentDetail_Init" 
                                            meta:resourcekey="gvadjustmentDetail">
                                            <PagerStyle CssClass="GridViewPageStyle" />
                                            <FooterStyle CssClass="GridViewFooterStyle" />
                                            <RowStyle CssClass="GridViewRowStyle" />
                                            <HeaderStyle CssClass="GridViewHeaderStyle" />
                                            <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                                            <Columns>
                                                <asp:BoundField HeaderText="序号" FooterText="序号" 
                                                    meta:resourcekey="BoundField">
                                                    <ItemStyle CssClass="GridViewRowWidth_40" />
                                                </asp:BoundField>
                                                <asp:TemplateField meta:resourcekey="TemplateField">
                                                    <HeaderTemplate>
                                                        <img src="../Images/gvSettingpic.gif" id="img01" class="gvSettingImg" onclick="gvUserSetting('5031','gvadjustmentDetail');" onmouseover="showGVUserSettingAlt(this);" alt="customize list" />
                                                        <asp:CheckBox ID="CheckBox1" runat="server" 
                                                            onclick="selectAll(this,'gvadjustmentDetail');" 
                                                            meta:resourcekey="CheckBox1" />
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="chbSelect" runat="server" 
                                                            meta:resourcekey="chbSelect" />
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        <asp:CheckBox ID="CheckBox2" runat="server" 
                                                            onclick="selectAll(this,'gvadjustmentDetail');" 
                                                            meta:resourcekey="CheckBox2" />
                                                    </FooterTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_50" />
                                                    <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_50" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="明细" FooterText="明细" 
                                                    meta:resourcekey="TemplateFieldResource2">
                                                    <ItemTemplate>
                                                        <a href='<%# FormatAdjustmentUrl("AdjustmentDetail.aspx?from={0}&ID={1}&LineID={2}&type=Edit",Eval("AdjustmentID").ToString(),Eval("LineID").ToString()) %>'
                                                            target="_self">
                                                            <img src="../Images/icon_edit.gif" class="img" style="border: none 0px blue;" alt="receipt" /></a>
                                                    </ItemTemplate>
                                                    <ItemStyle CssClass="GridViewRowWidth_50" HorizontalAlign="Center" />
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="LineID" HeaderText="行号" FooterText="行号" 
                                                    SortExpression="LineID" meta:resourcekey="LineID">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="SkuID" HeaderText="货品代码" FooterText="货品代码" 
                                                    SortExpression="SkuID" meta:resourcekey="SkuID">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:TemplateField FooterText="货品描述" HeaderText="货品描述" SortExpression="Descr" 
                                                    meta:resourcekey="Descr" >
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblSkuDescr" runat="server" 
                                                            Text='<%# Eval("Descr").ToString() %>' meta:resourcekey="lblSkuDescr"></asp:Label>
                                                    </ItemTemplate>
                                                    <ItemStyle CssClass="GridViewRowWidth_200" />       
                                                 </asp:TemplateField>
                                                <asp:BoundField DataField="PackID" HeaderText="包装" FooterText="包装" 
                                                    SortExpression="PackID" meta:resourcekey="PackID">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="UomID" HeaderText="单位" FooterText="单位" 
                                                    SortExpression="UomID" meta:resourcekey="UomID">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="Loc" HeaderText="货位" FooterText="货位" 
                                                    SortExpression="Loc" meta:resourcekey="Loc">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="Lot" HeaderText="批次号" FooterText="批次号" 
                                                    SortExpression="Lot" meta:resourcekey="Lot">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="LpnID" HeaderText="LPN" FooterText="LPN" 
                                                    SortExpression="LpnID" meta:resourcekey="LpnID">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="ReasonCode" HeaderText="原因" FooterText="原因" 
                                                    SortExpression="ReasonCode" meta:resourcekey="ReasonCode">
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:BoundField>
                                                <asp:TemplateField FooterText="数量" HeaderText="数量" SortExpression="Qty" 
                                                    meta:resourcekey="Qty">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblQty" runat="server" 
                                                            Text='<%# GetPreferenceDigit(Eval("Qty").ToString()) %>' 
                                                            meta:resourcekey="lblQty"></asp:Label>
                                                    </ItemTemplate>
                                                    <ItemStyle CssClass="GridViewRowWidth_100" />
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr style="height: 30px;">
                                <td>
                                </td>
                                <td>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="con_one_3" style="display: none;">
                        <table width="720px" style="display: block; margin-left: 10px; margin-top: 10px;">
                        </table>
                    </div>
                </div>
                <input type="hidden" id="hdnReceiptID" runat="server" />
                    <input id="hdnLineID" runat="server" type="hidden" value="10" />
                        <input id="hdnFrom" runat="server" type="hidden" />
                            <input id="hdnFlag" runat="server" type="hidden" />
                                <input id="hidCheck" runat="server" type="hidden" />
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnRefresh" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="btnNew" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <input type="hidden" id="hdnDataFormat" runat="server" />
    <input type="hidden" id="hdncalendarFlag" runat="server" />
    </form>
</body>
</html>

<script language="javascript" type="text/javascript" event="onclick" for="document">
		<!--
			hiddenCalendarDiv();
		//-->
</script>

